/*
 * @Author: WhiteWen 849019060@qq.com
 * @Date: 2025-02-18 15:51:52
 * @LastEditors: WhiteWen 849019060@qq.com
 * @LastEditTime: 2025-02-20 09:51:30
 * @FilePath: \git-subtree-test-main\sub-repo\src\utils\index.js
 * @Description: 
 */
/**
 * 从URL中获取查询参数并返回一个对象
 *
 * @returns {Object} 包含查询参数的对象
 */
export function getUrlParams() {
  const urlParams = new URLSearchParams(window.location.search);
  // 将参数转换为对象
  const paramsObj = {};
  for (const [key, value] of urlParams) {
    paramsObj[key] = value;
  }
  return paramsObj;
}

/**
 * 添加序号
 * @param {*} arrData
 * @returns 返回处理好的新数据
 */
export function addSerial(arrData = []) {
  let newData = arrData.map((item, index) => {
    return {
      ...item,
      serialnumber: Number(index + 1),
    };
  });
  return newData;
}

export default {
  getUrlParams,
  addSerial,
};